package com.daohang361.imqq.tool;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class PH {
	 public static Properties ph = new Properties();

		public  Map<Integer,String> getMap(String file)
		{
			String fileName="conf/"+file+".properties";
			try {
				//ph.load(getClass().getResourceAsStream(fileName));
				ph.load(new FileInputStream(new File(fileName)));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
			Map<Integer,String> commandList = new HashMap<Integer,String>();
			@SuppressWarnings("rawtypes")
			Set keys = ph.keySet();
			for(@SuppressWarnings("unchecked")
			Iterator<String> itr = keys.iterator(); itr.hasNext();){
				String key = (String) itr.next();
				 String value = ph.get(key)+"";
				 commandList.put(Integer.parseInt(key.replace("0x", ""),16), value);
			  }
			return commandList;
		}
}
